
const makeEventMap = <T extends Record<string, any>>() => { return {} as T }

// 事件名和返回参数类型的映射 TODO
const WEBVIEW_EVENT_PAYLOADS = makeEventMap<{
    'none': () => void
    'event-with-parameters': number[],
    'event-with-example-handler': (A: string[], B: string[]) => void
}>()

/** 运行时：所有支持的事件名 */
export const WEBVIEW_EVENTS = Object.keys(WEBVIEW_EVENT_PAYLOADS) as Array<
    keyof typeof WEBVIEW_EVENT_PAYLOADS
>

/** 编译时：事件名 到 载荷类型 的映射接口 */
export type EnumJSBridgeWebView = {
    [E in keyof typeof WEBVIEW_EVENT_PAYLOADS]: typeof WEBVIEW_EVENT_PAYLOADS[E]
}